<div class="mdui-card-header">
    <form id="queryForm">
        <div class="mdui-row">
            <input class="mdui-textfield-input mdui-col-xs-12 mdui-col-sm-3" type="text" placeholder="姓名" name="name" value="${(query.name)!}">
            <input class="mdui-textfield-input mdui-col-xs-12 mdui-col-sm-3 mdui-col-offset-sm-1" type="text" placeholder="手机号" name="mobile"  value="${(query.mobile)!}">
            <button type="button" id="queryBtn" onclick="query()" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="搜索"><i class="mdui-icon material-icons">&#xe8b6;</i></button>
            <button type="button" id="addBtn" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="温度异常记录" onclick="warming()"><i class="mdui-icon material-icons">&#xe002;</i></button>
        </div>
    </form>
</div>

<div class="mdui-card-content">
    <#if dataList?? && (dataList?size > 0)>
        <div class="mdui-table-fluid">
            <table class="mdui-table">
                <thead>
                <tr>
                    <th>类型</th>
                    <th>出入时间</th>
                    <th>姓名</th>
                    <th>手机号</th>
                    <th>温度</th>
                    <th>位置</th>
                    <th>记录人</th>
                    <th>记录人手机</th>
                    <th>状态</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <#list dataList as obj>
                    <tr>
                        <td>${obj.entryType!}</td>
                        <td>${obj.entryTimeStr!}</td>
                        <td>${obj.name!}</td>
                        <td>${obj.mobile!}</td>
                        <td>${obj.temperature!}</td>
                        <td>${obj.gateName!}</td>
                        <td>${obj.operatorName!}</td>
                        <td>${obj.operatorMobile!}</td>
                        <#if obj.temperature <= 37.3>
                            <td><span style="color: green">正常</span></td>
                        <#else>
                            <td><span style="color: red">异常</span></td>
                        </#if>
                        <td>${obj.remark!}</td>
                        <td>
                            <button onclick="userInfo(${obj.userType!},'${obj.userId!}')" type="button" class="mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="用户详情"><i class="mdui-icon material-icons">&#xe913;</i></button>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
        </div>
    <#else>
        <b>暂无信息</b>
    </#if>
</div>

<script>

    function query() {
        loadPost("record/index", $("#queryForm").serialize(), "#myContent", true);
    }
    
    function warming() {
        loadPost("record/index", 'warming=1', "#myContent", true);
    }

    function userInfo(userType,userId) {
        if(userType == 20){
            loadPost("student/index", 'id=' + userId, "#myContent", true);
        }else if(userType == 30){
            loadPost("teacher/index", 'id=' + userId, "#myContent", true);
        }else {
            loadPost("security/index", 'id=' + userId, "#myContent", true);
        }
    }

</script>
